package com.weetop.akly.presenter;

import android.app.Activity;

import com.weetop.akly.base.mvp.BaseModel;
import com.weetop.akly.base.mvp.BaseObserver;
import com.weetop.akly.base.mvp.BasePresenter;
import com.weetop.akly.bean.ApproveItem;
import com.weetop.akly.bean.DaySignBean;
import com.weetop.akly.bean.MsgBean;
import com.weetop.akly.bean.SignDayBean;
import com.weetop.akly.utils.TimeUtils;
import com.weetop.akly.view.SignDetailView;
import com.weetop.akly.view.SpRecordView;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class SignDetailPresent extends BasePresenter<SignDetailView> {
    public SignDetailPresent(SignDetailView baseView, Activity activity) {
        super(baseView, activity);
    }

    /**
     * 获取日历图
     *
     * @param month 格式：yyyy-MM
     */
    public void getCheckinWatch(String month) {
        addDisposable(apiServer.getCheckinWatch(month), new BaseObserver<BaseModel<List<SignDayBean>>>(baseView) {
            @Override
            public void onSuccess(BaseModel<List<SignDayBean>> o) {
                baseView.getCheckinWatchSuccess(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }

    /**
     * 日打卡情况
     *
     * @param day 格式：yyyy-MM-dd
     */
    public void getDayCheckinWatch(String day) {
        addDisposable(apiServer.getDateCheckinWatch(day), new BaseObserver<BaseModel<ArrayList<DaySignBean>>>(baseView) {
            @Override
            public void onSuccess(BaseModel<ArrayList<DaySignBean>> o) {
                baseView.getDayCheckinWatchSuccess(o);
            }

            @Override
            public void onError(String msg) {
                if (baseView != null) {
                    baseView.showError(msg);
                }
            }
        });
    }

}
